package com.example.crossborderecommerce.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.crossborderecommerce.entity.Admin;
import com.example.crossborderecommerce.entity.Store;
import com.example.crossborderecommerce.entity.StoreCommodity;
import com.example.crossborderecommerce.mapper.ProductCategoryMapper;
import com.example.crossborderecommerce.mapper.StoreMapper;
import com.example.crossborderecommerce.service.IStoreService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Yolanda
 * @since 2024-05-09
 */
@Service
public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements IStoreService {
    @Resource
    StoreMapper storeMapper;

    @Override
    public List<Admin> findAdminsInStore() {
        return storeMapper.findAdminsInStore();
    }

    @Override
    public StoreCommodity findStoreCommodityByStoreId(String storeId){return storeMapper.findStoreCommodityByStoreId(storeId);}
    @Override
    public StoreCommodity findStoreCommodityByStoreType(String type){return storeMapper.findStoreCommodityByStoreId(type);}

    @Override
    public List<Store> findStoreByType(String type) {
        QueryWrapper<Store> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("type", type);
        return storeMapper.selectList(queryWrapper);
    }
}
